<include file="public@header" />
</head>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('result/index')}">成绩列表</a></li>
        <li><a href="{:url('result/add')}">添加成绩</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('result/index')}">
    <span>成绩:</span>
        <input type="text" class="form-control" name="name" style="width: 120px;" placeholder="请输入成绩"  value="{$Request.param.name}">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('result/index')}" name="">清空</a>
        </form>
        <div>
            <a class="btn btn-success" href="{:url('result/exportExcel')}">导出Excel</a>
            <a class="btn btn-success" id="import">导入Excel</a>
            <a class="btn btn-success" href="{:url('result/download')}">下载导入模板</a>
        </div>

    <form method="post" class="js-ajax-form margin-top-20" action="{:url('result/delAll')}">
        <div class="table-actions">
            <button class="btn btn-sm btn-danger js-ajax-submit" type="submit"  onclick="delAll()"
                    data-action="{:url('result/delAll')}" data-subcheck="true">批量删除
            </button>
        </div>
    <form  class="margin-top-20">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
            <tr>
                <th width="16"><label><input type="checkbox" class="js-check-all" data-direction="x"
                                             data-checklist="js-check-x"></label></th>
                </th>
                <th width="80" align="center">ID</th>
                <th align="left" width="250px">学生姓名</th>
                <th align="left" width="250px">学生科目</th>
                <th align="left" width="250px">成绩</th>
                <th align="right"width="130">操作</th>
            </tr>
            </thead>
            <tbody>
           <foreach name="result" item="vo">
                <tr>
                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}"></td>
                    <td>{$key+1}</td>
                    <td>{$vo.student_name}</td>
                    <td>{$vo.subject_name}</td>
                    <td>{$vo.name}</td>
                    <td type="align:right">
                         <a class="btn btn-xs btn-primary " href="{:url('result/edit',array('id'=>$vo['id']))}">编辑</a>
                         <a class="btn btn-xs btn-danger js-ajax-delete" class="" href="{:url('result/delete',array('id'=>$vo['id']))}">删除</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
    </form>
    <div class="pagination">
        {$page}
    </div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/layui/layui.all.js"></script>
<script>
    layui.use('upload', function() {
        var upload = layui.upload;
        var uploadInst=upload.render({
            //要监听的元素
            elem:"#import",
            url:"{:url('result/importExcel')}",
            accept:'file',
            //请求成功时
            done:function (res) {
                layer.msg('成功导入'+res.success+'条数据');
                setTimeout(function () {
                    location.reload();
                },2000)
            }
        });
    });
</script>
</body>
</html>